<template>
    <router-view/>
</template>
<script>
import {
  Input,Button,ButtonGroup,Row,Col,Option,Select,Switch,Message,Dialog,MessageBox,Loading
} from 'element-ui';
import Vue from "vue";
import 'nprogress/nprogress.css';
Vue.component(Row.name,Row);
Vue.component(Col.name,Col);
Vue.component(Input.name,Input);
Vue.component(Select.name,Select);
Vue.component(Option.name,Option);
Vue.component(Button.name,Button);
Vue.component(Switch.name,Switch);
Vue.component(Dialog.name,Dialog);
Vue.component(ButtonGroup.name,ButtonGroup);
Vue.use(Loading.directive);
Vue.prototype.$message = Message;
Vue.prototype.$msgBox = MessageBox;
Vue.prototype.$loading = Loading.service;
Vue.prototype.$confirm = MessageBox.confirm;
import { alertMessage } from '@/config/myUtil';
export default {
  name:"App",
  created(){
    let accessToken = window.localStorage.getItem('wpsmAccessToken');
    if(!this.$store.state.userMsg.name && accessToken){
      this.$store.dispatch("getThismsgUaa");
    }
  },
  watch:{
    $route(to,from){
      this.$store.dispatch("watchPageAuth",to.name).then((res)=>{
        if(!res){
          alertMessage("你没有页面的访问权限","warning");
          this.$router.replace({name:"menu"});
        }
      })
    }
  },
}
</script>
<style lang="less">
@import url('./assets/style/base.css');
@import url('./assets/style/public.less');
</style>